namespace Vanilla.UI


// FONT
enum FontSlant:
	Normal
	Italic

enum FontWeight:
	Normal
	Bold

struct TextExtents:
	XBearing as double
	YBearing as double
	Width as double
	Height as double
	XAdvance as double
	YAdvance as double

class Font:
	public Face as string
	public Pt as double
	public Slant as FontSlant
	public Weight as FontWeight
	
	def constructor (face as string, pt as double, slant as FontSlant, weight as FontWeight):
		Face = face
		Pt = pt
		Slant = slant
		Weight = weight
	
	def constructor (face as string, pt as double):
		self(face, pt, FontSlant.Normal, FontWeight.Normal)
	
	def constructor (face as string):
		self(face,14)
	
	def constructor ():
		self("Arial")
	
	def Extents (s as string) as TextExtents:
		using c = BitmapCanvas(1,1):
			using b = Brush(c):
				b.Font = self
				e as TextExtents
				Cairo.TextExtents(b.Handle, s, e)
				return e
	
	def Size (s as string):
		e = Extents(s)
		return Vanilla.UI.Size(e.Width, e.Height)
